package base;

import java.util.ArrayList;

public class LocalServer {
	private Client client;
	private Game game;
	
	public Client register() {
		this.client = new Client();
		return this.client;
	}

	ArrayList<Client> getClients() {
		ArrayList<Client> clients = new ArrayList<Client>();
		clients.add(this.client);
		return clients;
	}

	public void setGame(Game game) {
		this.game = game;
		
		for (Player player : this.getGame().getEngine().getBoard().getPlayers()) {
			if (player instanceof ComputerPlayer) {
				player.setClient(this.register());
				this.getGame().addClient(player.getClient());
				this.getGame().getEngine().addTurnListener((ComputerPlayer) player);
			}
		}
	}

	private Game getGame() {
		return this.game;
	}
}
